﻿// See https://aka.ms/new-console-template for more information
using System.Diagnostics;

Stopwatch stopwatch=new Stopwatch();
stopwatch.Start();
var task1 = dosomething1();
var task2 = dosomething2();
await Task.WhenAll(task1,task2);
stopwatch.Stop();

Console.WriteLine("程序总耗时:"+stopwatch.Elapsed);

Console.WriteLine("Hello, World!");

async Task dosomething1()
{
    await Task.Delay(1000);
    Console.WriteLine("do something1");
}

async Task dosomething2()
{
    await Task.Delay(2000);
    Console.WriteLine("do some thing2");
}
